# Include # Include # Include # Include
Typedef struct{Int X; // The X coordinate of the array.Int y; // The ordinate of the input array.} Elemtype;
Static elemtype list [81]; // defines a tablespace.Int Len =-1; // Len record table size
Void addlistelem (elemtype );Int getlistelem (elemtype *, INT );Void showme (INT [] [9]);Int addcount (INT [] [9]);Int checkline (INT [] [9], Int, INT );Int checkrow (INT [] [9], Int, INT );Int checkpalace (INT [] [9
b, analysis of the chessboard data structure
1.2.4, read the current board data--------------------------17
A, programming to read the board data
b, Board data show
1.3, using simulation technology to compile external-------------------------------18
1.3.1 Analysis of Chess and board coordinate relations
A, mouse software simulation, function SendMessage
b, Analysis window pieces relative coordinates x,y
c, software simulation Click the chessboard coordinates x,y at the pawn
1.3.2 Elimination o
,objlistfile
ListFile = "" To set the profile path, if the configuration file and script are put together, leave it as is
If listfile = "" Then listfile = "Listfile.ini"
Set Fso = CreateObject ("Scripting.FileSystemObject")
On Error Resume Next
Set objlistfile = Fso.opentextfile (listfile,1)
If ERR Then
Err. Clear
Msgbox "No configuration file found" listfile,16, "error"
Wscript.Quit
End If
On Error GoTo 0
Dim Flnum,fdnum,t1,t2,tm
Flnum=0
Fdnum=0
T1 = timer ()
Dim Myline,linearr,listarr
Do Wh
Bool Check2p (POINT a, POINT B) // The p1, p2 {CChessPoint p1 (a), p2 (B) of the two target pawns are transmitted here ); // two class objects are declared here. The specific class contains the upper and lower POINT pa and pa of p1 and p2; // Two Corner Points if (. x = B. x) (. y = B. y) // a is the p1 pawn, B is the p2 pawn {return false;} else if (chessdata [. y] [. x] = 0) | (chessdata [B. y] [B. x) = 0) // if the p1 pawns are empty {return false;} // false else if (chessdata [. y] [. x]! =
("Scripting.FileSystemObject")
On Error Resume Next
Set objlistfile = Fso.opentextfile (listfile,1)
If ERR Then
Err. Clear
Msgbox "No configuration file found" listfile,16, "error"
Wscript.Quit
End If
On Error GoTo 0
Dim Flnum,fdnum,t1,t2,tm
Flnum=0
Fdnum=0
T1 = timer ()
Dim Myline,linearr,listarr
Do While Objlistfile.atendofstream Myline = LCase (Replace (objlistfile.readline, "=", "="))
If Left (myline,1) = "/" Then
' Objlistfile.skipline
ElseIf checkli
= col ))55 return 0;56 return 1;57}5859/* Check row conflicts */60 int CheckLine (int line, int col, int num)61 {62 int I = 9;63 while (I --)64 if (data [line] [I] = num) (I! = Col ))65 return 0;66 return 1;67}6869/* Check column conflicts */70 int CheckColumn (int line, int col, int num)71 {72 int I = 9;73 while (I --)74 if (data [I] [col] = num) (I! = Line ))75 return 0;76 return 1;77}7879/* check whether num can be placed in column j of row I */
;
}
}
// Filled
If (iscorret (I, j )){
// Initialize time to prepare for the next fill
Time = 0;
} Else {// continue filling
// Increase by 1
Time ++;
// Continue filling the current grid
J --;
}
}
}
// Output result
For (INT I = 0; I For (Int J = 0; j System. Out. Print (N [I] [J] + "");
}
System. Out. println ();
}
}
/**
* Whether the row, column, and 3x3 fields are not repeated
* @ Param row
* @ Param Col column number
* @ Return true indicates that the request meets the requirements.
*/
Pub
backwards to the last column of the previous row.If (n [I] [j] = 0 ){// If the column is not the first, a backward column is returned.If (j> 0 ){J-= 2;Continue;} If else {// is the first column, it is regressed to the last column of the previous row.I --;J = 8;Continue;}}// FilledIf (isCorret (I, j )){// Initialize time to prepare for the next fillTime = 0;} Else {// continue filling// Increase by 1Time ++;// Continue filling the current gridJ --;}}}// Output resultFor (int I = 0; I For (int j
Bool checkline (point P1, point P2) {int X, Y, T; // If the X axis is the same, if the Y axis is the same, one point is null, and another point is null if (p1.x = p2.x) (p1.y = p2.y) (chessdata [p1.y] [p1.x] = 0) (chessdata [p2.y] [p2.x] = 0 )) {return turn;} // If the P1 axis is smaller than 0 and greater than 18 or the P2 axis is smaller than 0 and greater than 18 else if (p1.x
this paper is a tool class to read the corresponding class object in order to realize the CSV file which is specified in the above-described format.
The next article will write a code auto-generation tool that automatically generates code for the class object corresponding to each table
(Because the plan to modify the table structure is very frequent, the table structure once modified, the corresponding class structure will be modified, simply automatically generate trouble)
Csvreader provides
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.